
/*  netaddisplayer,net AD displayer.
    Copyright (C) 2010-2010 ljj <ljj422@gmial.com>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/


#ifndef _PLAYLIST_H_
#define _PLAYLIST_H_

#include <QList>
#include <QMap>
#include <QMapIterator>
#include <QFile>
#include <QString>
#include <QStringList>
#include <QXmlStreamReader>


class Playfile {
	public:
		QString filename, netfilename;
                long sdate,edate;
                int week,num;
                bool playfilestate;
                Playfile(){filename="";netfilename="";sdate=0;edate=0;week=0;num=0;playfilestate=false;};
}; 

enum enumPlaytimeState{
        enPlaytimeNull,
	enPlaytimeEmpty,
       enPlaytimePlayfileEmpty,	
	enPlaytimeReady
};

class Playtime{
	public:
		typedef QList <Playfile> PlayfileList;
		PlayfileList pfl;
		int priority;
		enumPlaytimeState PlaytimeState;
                long stime,etime;
                Playtime(){pfl.clear();priority=0;stime=0;etime=0;PlaytimeState=enPlaytimeNull;};
};

class WindowSize{
	public:
		int x;
		int y;
		int width;
		int hight;
		WindowSize(){x=0;y=0;width=0;hight=0;};
		
};

enum enumPlaylistState{
	enPlaylistEmpty,
	enPlaylistError,
	enPlaylistReady,
	enPlaylistPlaying,
};

class Playlist: public QObject
{
	Q_OBJECT
public:
        Playlist(QString &fileName);
        ~Playlist(){};
        int Crren;
	void clear();
	int count();
	bool isEmpty();
        typedef QMap<long,Playtime>mapPlayList;
        mapPlayList pl;
//private:
    public:
        mapPlayList::Iterator PlayListIndex;
        QString PlayListfileName; 
        QXmlStreamReader xml;
        int xmltype,powersave;
	 WindowSize winsize;
	 enumPlaylistState playliststate;
    	void parseXml(QString &fileName);
};














#endif
